﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using DataModel.Managers;
using DataModel.Models;

namespace UniversityPortal.Controllers.Responses
{
    public class EditLessonResponse
    {
        public List<Entity> subjects { get; set; }
        public List<Entity> professors { get; set; }
        public List<Entity> auditories { get; set; }
        public List<Entity> lessontypes { get; set; }

        public EditLessonResponse()
        {
            var universityModel = new UniversityPortalEntities();

            this.subjects = new List<Entity>();
            this.professors = new List<Entity>();
            this.lessontypes = new List<Entity>();
            this.auditories = new List<Entity>();

            foreach (var professor in universityModel.Professors)
            {
                professors.Add(new Entity() { ID = professor.ID, Name = professor.User.lastName });
            }

            foreach (var auditory in universityModel.Auditories)
            {
                auditories.Add(new Entity() { ID = auditory.ID, Name = auditory.FullName });
            }

            foreach (var subject in universityModel.Subjects)
            {
                subjects.Add(new Entity() { ID = subject.ID, Name = subject.shortName });
            }

            foreach (var lessonType in universityModel.LessonTypes)
            {
                lessontypes.Add(new Entity() { ID = lessonType.ID, Name = lessonType.name });
            }
        }
    }
}